home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / gcc / gcc260utilsdoc.lha / gnu / man / man1 / gzip.1 < prev    next >
Encoding:
Text File  |  1994-07-30  |  16.9 KB  |  463 lines

  1.  
  2.  
  3.  
  4. GZIP(1)                  USER COMMANDS                    GZIP(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      gzip, gunzip, zcat - compress or expand files
  10.  
  11. SYNOPSIS
  12.      gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ _n_a_m_e ... ]
  13.      gunzip [ -acfhlLnNrtvV ] [-S suffix] [ _n_a_m_e ... ]
  14.      zcat [ -fhLV ] [ _n_a_m_e ... ]
  15.  
  16. DESCRIPTION
  17.      _G_z_i_p reduces the size of the named  files  using  Lempel-Ziv
  18.      coding  (LZ77).  Whenever possible, each file is replaced by
  19.      one with the extension .gz, while keeping the same ownership
  20.      modes,  access  and modification times.  (The default exten-
  21.      sion is -gz for VMS, z for MSDOS, OS/2 FAT, Windows  NT  FAT
  22.      and  Atari.) If no files are specified, or if a file name is
  23.      "-", the standard input is compressed to the  standard  out-
  24.      put.   _G_z_i_p will only attempt to compress regular files.  In
  25.      particular, it will ignore symbolic links.
  26.  
  27.      If the compressed file name is too long for its file system,
  28.      _g_z_i_p truncates it.  _G_z_i_p attempts to truncate only the parts
  29.      of the file name longer than 3 characters.  (A part is  del-
  30.      imited  by  dots.) If the name consists of small parts only,
  31.      the longest parts are truncated. For example, if file  names
  32.      are  limited  to 14 characters, gzip.msdos.exe is compressed
  33.      to gzi.msd.exe.gz.  Names are not truncated on systems which
  34.      do not have a limit on file name length.
  35.  
  36.      By default, _g_z_i_p keeps the original file name and  timestamp
  37.      in  the  compressed  file. These are used when decompressing
  38.      the file with  the  -N  option.  This  is  useful  when  the
  39.      compressed  file  name  was truncated or when the time stamp
  40.      was not preserved after a file transfer.
  41.  
  42.      Compressed files can be  restored  to  their  original  form
  43.      using  _g_z_i_p -_d or _g_u_n_z_i_p or _z_c_a_t. If the original name saved
  44.      in the compressed file is not suitable for its file  system,
  45.      a  new  name is constructed from the original one to make it
  46.      legal.
  47.  
  48.      _g_u_n_z_i_p takes a  list  of  files  on  its  command  line  and
  49.      replaces each file whose name ends with .gz, -gz, .z, -z, _z
  50.      or .Z and which begins with the correct magic number with an
  51.      uncompressed  file  without  the original extension.  _g_u_n_z_i_p
  52.      also recognizes the special  extensions  .tgz  and  .taz  as
  53.      shorthands   for  .tar.gz  and  .tar.Z  respectively.   When
  54.      compressing, _g_z_i_p  uses  the  .tgz  extension  if  necessary
  55.      instead of truncating a file with a .tar extension.
  56.  
  57.      _g_u_n_z_i_p can currently decompress files created by _g_z_i_p,  _z_i_p,
  58.      _c_o_m_p_r_e_s_s,  _c_o_m_p_r_e_s_s  -_H  or _p_a_c_k. The detection of the input
  59.      format is automatic.  When  using  the  first  two  formats,
  60.  
  61.  
  62.  
  63. Sun Release 4.1        Last change: local                       1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GZIP(1)                  USER COMMANDS                    GZIP(1)
  71.  
  72.  
  73.  
  74.      _g_u_n_z_i_p  checks  a  32  bit  CRC. For _p_a_c_k, _g_u_n_z_i_p checks the
  75.      uncompressed length. The standard _c_o_m_p_r_e_s_s  format  was  not
  76.      designed  to  allow  consistency  checks.  However _g_u_n_z_i_p is
  77.      sometimes able to detect a bad .Z file. If you get an  error
  78.      when uncompressing a .Z file, do not assume that the .Z file
  79.      is correct simply because the standard _u_n_c_o_m_p_r_e_s_s  does  not
  80.      complain.  This generally means that the standard _u_n_c_o_m_p_r_e_s_s
  81.      does not check its input, and happily generates garbage out-
  82.      put.   The  SCO  compress -H format (lzh compression method)
  83.      does not include a CRC  but  also  allows  some  consistency
  84.      checks.
  85.  
  86.      Files created by _z_i_p can be uncompressed  by  gzip  only  if
  87.      they  have  a  single member compressed with the 'deflation'
  88.      method. This feature is only intended to help conversion  of
  89.      tar.zip  files  to  the  tar.gz format. To extract zip files
  90.      with several members, use _u_n_z_i_p instead of _g_u_n_z_i_p.
  91.  
  92.      _z_c_a_t is identical to _g_u_n_z_i_p -c. (On some systems,  _z_c_a_t  may
  93.      be  installed  as  _g_z_c_a_t  to  preserve  the original link to
  94.      _c_o_m_p_r_e_s_s.) _z_c_a_t uncompresses either a list of files  on  the
  95.      command   line   or   its  standard  input  and  writes  the
  96.      uncompressed data on standard output.  _z_c_a_t will  uncompress
  97.      files that have the correct magic number whether they have a
  98.      .gz suffix or not.
  99.  
  100.      _G_z_i_p uses the Lempel-Ziv algorithm used in  _z_i_p  and  PKZIP.
  101.      The  amount  of  compression obtained depends on the size of
  102.      the input and the distribution of common substrings.   Typi-
  103.      cally,  text  such  as  source code or English is reduced by
  104.      60-70%.  Compression is  generally  much  better  than  that
  105.      achieved  by  LZW  (as used in _c_o_m_p_r_e_s_s), Huffman coding (as
  106.      used in _p_a_c_k), or adaptive Huffman coding (_c_o_m_p_a_c_t).
  107.  
  108.      Compression is always performed, even if the compressed file
  109.      is  slightly larger than the original. The worst case expan-
  110.      sion is a few bytes for the gzip file header, plus  5  bytes
  111.      every  32K  block, or an expansion ratio of 0.015% for large
  112.      files. Note that the  actual  number  of  used  disk  blocks
  113.      almost  never increases.  _g_z_i_p preserves the mode, ownership
  114.      and timestamps of files when compressing or decompressing.
  115.  
  116.  
  117. OPTIONS
  118.      -a --ascii
  119.           Ascii text mode: convert end-of-lines using local  con-
  120.           ventions.  This  option  is supported only on some non-
  121.           Unix systems. For MSDOS, CR LF is converted to LF  when
  122.           compressing,   and  LF  is  converted  to  CR  LF  when
  123.           decompressing.
  124.  
  125.      -c --stdout --to-stdout
  126.  
  127.  
  128.  
  129. Sun Release 4.1        Last change: local                       2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. GZIP(1)                  USER COMMANDS                    GZIP(1)
  137.  
  138.  
  139.  
  140.           Write output on standard output;  keep  original  files
  141.           unchanged.   If there are several input files, the out-
  142.           put consists of a sequence of independently  compressed
  143.           members.  To obtain better compression, concatenate all
  144.           input files before compressing them.
  145.  
  146.      -d --decompress --uncompress
  147.           Decompress.
  148.  
  149.      -f --force
  150.           Force compression or decompression even if the file has
  151.           multiple   links  or  the  corresponding  file  already
  152.           exists, or if the compressed data is read from or writ-
  153.           ten to a terminal. If the input data is not in a format
  154.           recognized by _g_z_i_p, and if the option --stdout is  also
  155.           given,  copy the input data without change to the stan-
  156.           dard ouput: let _z_c_a_t behave as _c_a_t. If -f is not given,
  157.           and when not running in the background, _g_z_i_p prompts to
  158.           verify whether an existing file should be overwritten.
  159.  
  160.      -h --help
  161.           Display a help screen and quit.
  162.  
  163.      -l --list
  164.           For each compressed file, list the following fields:
  165.  
  166.               compressed size: size of the compressed file
  167.               uncompressed size: size of the uncompressed file
  168.               ratio: compression ratio (0.0% if unknown)
  169.               uncompressed_name: name of the uncompressed file
  170.  
  171.           The uncompressed size is given as -1 for files  not  in
  172.           gzip  format,  such  as compressed .Z files. To get the
  173.           uncompressed size for such a file, you can use:
  174.  
  175.               zcat file.Z | wc -c
  176.  
  177.           In combination with the --verbose option, the following
  178.           fields are also displayed:
  179.  
  180.               method: compression method
  181.               crc: the 32-bit CRC of the uncompressed data
  182.               date & time: time stamp for the uncompressed file
  183.  
  184.           The  compression  methods   currently   supported   are
  185.           deflate, compress, lzh (SCO compress -H) and pack.  The
  186.           crc is given as ffffffff for a file not in gzip format.
  187.  
  188.           With --name, the uncompressed name,  date and time  are
  189.           those stored within the compress file if present.
  190.  
  191.           With --verbose, the size totals and  compression  ratio
  192.  
  193.  
  194.  
  195. Sun Release 4.1        Last change: local                       3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. GZIP(1)                  USER COMMANDS                    GZIP(1)
  203.  
  204.  
  205.  
  206.           for  all files is also displayed, unless some sizes are
  207.           unknown. With --quiet, the title and totals  lines  are
  208.           not displayed.
  209.  
  210.      -L --license
  211.           Display the _g_z_i_p license and quit.
  212.  
  213.      -n --no-name
  214.           When compressing, do not save the  original  file  name
  215.           and time stamp by default. (The original name is always
  216.           saved  if  the  name  had  to   be   truncated.)   When
  217.           decompressing, do not restore the original file name if
  218.           present  (remove  only  the  _g_z_i_p   suffix   from   the
  219.           compressed  file  name) and do not restore the original
  220.           time stamp if present  (copy  it  from  the  compressed
  221.           file). This option is the default when decompressing.
  222.  
  223.      -N --name
  224.           When compressing, always save the  original  file  name
  225.           and  time  stamp; this is the default. When decompress-
  226.           ing, restore the original file name and time  stamp  if
  227.           present.  This option is useful on systems which have a
  228.           limit on file name length or when the  time  stamp  has
  229.           been lost after a file transfer.
  230.  
  231.      -q --quiet
  232.           Suppress all warnings.
  233.  
  234.      -r --recursive
  235.           Travel the directory structure recursively. If  any  of
  236.           the file names specified on the command line are direc-
  237.           tories,  _g_z_i_p  will  descend  into  the  directory  and
  238.           compress  all  the  files it finds there (or decompress
  239.           them in the case of _g_u_n_z_i_p ).
  240.  
  241.      -S .suf --suffix .suf
  242.           Use suffix .suf instead  of  .gz.  Any  suffix  can  be
  243.           given,  but  suffixes  other  than .z and .gz should be
  244.           avoided to avoid confusion when files  are  transferred
  245.           to  other systems.  A null suffix forces gunzip to  try
  246.           decompression on all given files regardless of  suffix,
  247.           as in:
  248.  
  249.               gunzip -S "" *       (*.* for MSDOS)
  250.  
  251.           Previous versions of gzip used the .z suffix. This  was
  252.           changed to avoid a conflict with _p_a_c_k(1).
  253.  
  254.      -t --test
  255.           Test. Check the compressed file integrity.
  256.  
  257.      -v --verbose
  258.  
  259.  
  260.  
  261. Sun Release 4.1        Last change: local                       4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. GZIP(1)                  USER COMMANDS                    GZIP(1)
  269.  
  270.  
  271.  
  272.           Verbose. Display the name and percentage reduction  for
  273.           each file compressed or decompressed.
  274.  
  275.      -V --version
  276.           Version. Display the  version  number  and  compilation
  277.           options then quit.
  278.  
  279.      -# --fast --best
  280.           Regulate the speed of compression using  the  specified
  281.           digit  #,  where  -1  or  --fast  indicates the fastest
  282.           compression method (less compression) and -9 or  --best
  283.           indicates the slowest compression method (best compres-
  284.           sion).  The default compression level is -6  (that  is,
  285.           biased towards high compression at expense of speed).
  286.  
  287. ADVANCED USAGE
  288.      Multiple compressed files can be concatenated. In this case,
  289.      _g_u_n_z_i_p will extract all members at once. For example:
  290.  
  291.            gzip -c file1  > foo.gz
  292.            gzip -c file2 >> foo.gz
  293.  
  294.      Then
  295.            gunzip -c foo
  296.  
  297.      is equivalent to
  298.  
  299.            cat file1 file2
  300.  
  301.      In case of damage to one member of a .gz file, other members
  302.      can  still  be recovered (if the damaged member is removed).
  303.      However, you can get better compression by  compressing  all
  304.      members at once:
  305.  
  306.            cat file1 file2 | gzip > foo.gz
  307.  
  308.      compresses better than
  309.  
  310.            gzip -c file1 file2 > foo.gz
  311.  
  312.      If you want to recompress concatenated files to  get  better
  313.      compression, do:
  314.  
  315.            gzip -cd old.gz | gzip > new.gz
  316.  
  317.      If a  compressed  file  consists  of  several  members,  the
  318.      uncompressed  size  and  CRC  reported  by the --list option
  319.      applies  to  the  last  member  only.  If   you   need   the
  320.      uncompressed size for all members, you can use:
  321.  
  322.            gzip -cd file.gz | wc -c
  323.  
  324.  
  325.  
  326.  
  327. Sun Release 4.1        Last change: local                       5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. GZIP(1)                  USER COMMANDS                    GZIP(1)
  335.  
  336.  
  337.  
  338.      If you wish to create a single archive  file  with  multiple
  339.      members  so  that  members  can  later be extracted indepen-
  340.      dently, use an archiver such as tar or zip. GNU tar supports
  341.      the -z option to invoke gzip transparently. gzip is designed
  342.      as a complement to tar, not as a replacement.
  343.  
  344. ENVIRONMENT
  345.      The environment variable GZIP can  hold  a  set  of  default
  346.      options  for  _g_z_i_p.  These options are interpreted first and
  347.      can be overwritten by explicit command line parameters.  For
  348.      example:
  349.            for sh:    GZIP="-8v --name"; export GZIP
  350.            for csh:   setenv GZIP "-8v --name"
  351.            for MSDOS: set GZIP=-8v --name
  352.  
  353.      On  Vax/VMS,  the  name  of  the  environment  variable   is
  354.      GZIP_OPT,  to avoid a conflict with the symbol set for invo-
  355.      cation of the program.
  356.  
  357. SEE ALSO
  358.      znew(1), zcmp(1),  zmore(1),  zforce(1),  gzexe(1),  zip(1),
  359.      unzip(1), compress(1), pack(1), compact(1)
  360.  
  361. DIAGNOSTICS
  362.      Exit status is normally 0; if an error occurs,  exit  status
  363.      is 1. If a warning occurs, exit status is 2.
  364.  
  365.      Usage: gzip [-cdfhlLnNrtvV19] [-S suffix] [file ...]
  366.              Invalid options were specified on the command line.
  367.      _f_i_l_e: not in gzip format
  368.              The  file  specified  to   _g_u_n_z_i_p   has   not   been
  369.              compressed.
  370.      _f_i_l_e: Corrupt input. Use zcat to recover some data.
  371.              The compressed file has been damaged. The data up to
  372.              the point of failure can be recovered using
  373.                      zcat file > recover
  374.      _f_i_l_e: compressed with _x_x bits, can only handle _y_y bits
  375.              _F_i_l_e was compressed (using LZW) by  a  program  that
  376.              could  deal  with more _b_i_t_s than the decompress code
  377.              on this machine.  Recompress  the  file  with  gzip,
  378.              which compresses better and uses less memory.
  379.      _f_i_l_e: already has .gz suffix -- no change
  380.              The  file  is  assumed  to  be  already  compressed.
  381.              Rename the file and try again.
  382.      _f_i_l_e already exists; do you wish to overwrite (y or n)?
  383.              Respond "y" if  you  want  the  output  file  to  be
  384.              replaced; "n" if not.
  385.      gunzip: corrupt input
  386.              A SIGSEGV violation was detected which usually means
  387.              that the input file has been corrupted.
  388.      _x_x._x%
  389.              Percentage  of  the  input  saved  by   compression.
  390.  
  391.  
  392.  
  393. Sun Release 4.1        Last change: local                       6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. GZIP(1)                  USER COMMANDS                    GZIP(1)
  401.  
  402.  
  403.  
  404.              (Relevant only for -v and -l.)
  405.      -- not a regular file or directory: ignored
  406.              When the input file is not a regular file or  direc-
  407.              tory,  (e.g.  a  symbolic link, socket, FIFO, device
  408.              file), it is left unaltered.
  409.      -- has _x_x other links: unchanged
  410.              The input file has links; it is left unchanged.  See
  411.              _l_n(1) for more information. Use the -f flag to force
  412.              compression of multiply-linked files.
  413.  
  414. CAVEATS
  415.      When writing compressed data to  a  tape,  it  is  generally
  416.      necessary  to pad the output with zeroes up to a block boun-
  417.      dary. When the data is read and the whole block is passed to
  418.      _g_u_n_z_i_p for decompression, _g_u_n_z_i_p detects that there is extra
  419.      trailing garbage after the compressed data and emits a warn-
  420.      ing  by  default.  You  have  to  use  the --quiet option to
  421.      suppress the warning. This option can be  set  in  the  GZIP
  422.      environment variable as in:
  423.        for sh:  GZIP="-q"  tar -xfz --block-compress /dev/rst0
  424.        for csh: (setenv GZIP -q; tar -xfz --block-compr /dev/rst0
  425.  
  426.      In the above example, gzip is invoked implicitly by  the  -z
  427.      option  of  GNU  tar. Make sure that the same block size (-b
  428.      option of tar) is used for reading  and  writing  compressed
  429.      data  on tapes.  (This example assumes you are using the GNU
  430.      version of tar.)
  431.  
  432. BUGS
  433.      The --list option reports incorrect sizes if they  exceed  2
  434.      gigabytes.  The --list option reports sizes as -1 and crc as
  435.      ffffffff if the compressed file is on a non seekable media.
  436.  
  437.      In some rare cases, the --best option gives  worse  compres-
  438.      sion than the default compression level (-6). On some highly
  439.      redundant files, _c_o_m_p_r_e_s_s compresses better than _g_z_i_p.
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459. Sun Release 4.1        Last change: local                       7
  460.  
  461.  
  462.  
  463.